{extend name="public:base"/}


{block name="title"}新增商品属性{/block}
{block name="style"}{/block}

{block name="main"}

<section class="content" xmlns="http://www.w3.org/1999/html">
    <div class="row">

        <div class="col-md-12">

            <div class="row">
                <div class="col-lg-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">新增商品属性</h3>
                        </div>
                        <form  id="pt_form" method="post">
                            <div class="box-body">

                                <div class="clearfix"></div>

     
                                <div class="form-group required">
                                    <div class='col-sm-2 text-right'>
                                        <label for="attr_name" class="control-label Validform_label" >属性名称</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <input type="text" id="attr_name" class="form-control" name="attr_name" placeholder="请输入属性名称" datatype="s2-60" nullmsg="请填写属性名称">
                                        <div class="help-block"></div>
                                    </div>
                                </div>
          
                                <div class="form-group required">
                                    <div class='col-sm-2 text-right'>
                                        <label class="control-label" for="type_id">所属商品模型</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <select id="type_id" class="form-control" name="type_id">
                                            <option value="0">请选择</option>
                                            <?php if(!empty($goodsType)){foreach($goodsType as $k=>$v){?>
                                                <option value="<?=$v['id']?>"><?=$v['type_name']?></option>
                                            <?php }}?>
                                        </select>
                                        <div class="help-block"></div>
                                    </div>
                                </div>
     
                                <div class="form-group required" >
                                    <div class="col-sm-2 text-right">
                                        <label class="control-label Validform_label">能否进行检索                                        </label>
                                    </div>

                                    <div class="col-sm-10">
                                        <div>
                                      
                                            <span style="color:#636f7a"><input type="radio" name="attr_index" value="0" datatype="*"  nullmsg="请确认是否检索" checked="checked">不需要检索</span>

                                            <span style="color:#636f7a"><input type="radio" name="attr_index" value="1" >关键字检索</span>
                                        </div>
                                        <div class="help-block"></div>
                                    </div>
                                </div>

     
                                <div class="form-group" >
                                    <div class="col-sm-2 text-right">
                                        <label class="control-label Validform_label"> 该属性值的录入方式                                        </label>
                                    </div>

                                    <div class="col-sm-10">
                                        <div id="is_privilege">
                                            <label style="color:#636f7a"><input type="radio" name="attr_input_type" value="0" datatype="*"  nullmsg="请选择该属性值的录入方式" checked="checked">手工录入 </label>

                                            
                                            <label style="color:#636f7a"><input type="radio" name="attr_input_type" value="1" >从下面的列表中选择（一行代表一个可选值）</label>

                                            <label style="color:#636f7a"><input type="radio" name="attr_input_type" value="2" >多行文本框</label>


                                        </div>
                                        <div class="help-block"></div>
                                    </div>
                                </div>

     
                                <div class="form-group required">
                                    <div class='col-sm-2 text-right'>
                                        <label for="attr_values" class="control-label Validform_label" >可选值列表</label>
                                    </div>
                                    <div class='col-sm-10'>

                                        <textarea id="attr_values" style="height:200px" class="form-control" name="attr_values" placeholder="请输入可选值"  datatype="*"  ignore="ignore" nullmsg="请填写可选值"></textarea>
                                        <div class="help-block">
                                            录入方式为手工或者多行文本时，此输入框不需填写</div>
                                    </div>

                                </div>
     
                                <div class="form-group required" >
                                    <div class="col-sm-2 text-right">
                                        <label class="control-label Validform_label">属性排序                                        </label>
                                    </div>

                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="order" placeholder="请输入排序数字" datatype="n" nullmsg="请填写排序数字" value="0">
                                        <div class="help-block"></div>
                                    </div>
                                </div>

                            </div>
                            <div class="box-footer text-center">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <span class="btn btn-white" onclick="history.go(-1)">返回</span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
{/block}

{block name="js"}
<script>

    var validate = validator('#pt_form');

    $('input[name="attr_input_type"]').click(function(){
        let form_val = $('input[name="attr_input_type"]:checked').val();
        if(form_val != 1){
            $('#attr_values').prop('disabled',true);
        }else{
            $('#attr_values').prop('disabled',false);
        }
    });
</script>
{/block}